package com.xiaoge.basedevlibrary.base;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.xiaoge.basedevlibrary.R;
import com.xiaoge.basedevlibrary.utils.AppUtil;

/**
 * Created by guoyzh on 2017-8-8 0008.
 */

public class GuoBaseActivity extends AppCompatActivity {

    public Activity mActivity;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mActivity = this;
        // 设置主题
        setTheme(R.style.AppTheme);
        // 设置状态栏透明
        // StatusBarUtil.immersive(mActivity);
        // StatusBarUtil.darkMode(mActivity);
        // 方便全局通过AppUtils获取上下文
        AppUtil.setActivity(this);

    }

    @Override
    protected void onRestart() {
        super.onRestart();
        AppUtil.setActivity(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        AppUtil.setActivity(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();


        // 实现右侧退出功能必须重写这个方法  推荐将此功能写在BaseActivity中
        overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
    }
}
